package com.example.demo.web;

import com.example.demo.exception.MyException;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import springfox.documentation.annotations.ApiIgnore;

/**
 * Created by huxin on 2017/7/31.
 */
@Controller
public class HelloControllar {

    @ApiIgnore
    @RequestMapping("/hello")
    public String index(ModelMap modelMap){
        modelMap.addAttribute("host","http://blog.hx.com/");
        return "hello";
    }

    @ApiIgnore
    @RequestMapping("/helloerror")
    public String indexErr() throws Exception{
        throw new Exception("qweqwe");
    }

    @RequestMapping("/json")
    public String json() throws MyException {
        throw new MyException("发生错误2");
    }
}
